package com.free.ext.web.spring.view;

import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpOutputMessage;

import java.io.IOException;
import java.io.OutputStream;

/**
 * <p>
 * 功能概述:
 * </p>
 * <p>
 * 功能详述:
 * </p>
 */
public class HttpStreamOutputMessage implements HttpOutputMessage {

    /*========================================================================*
     *                         Public Fields (公共属性)
     *========================================================================*/

    /*========================================================================*
     *                         Private Fields (私有属性)
     *========================================================================*/

    private OutputStream stream;
    private HttpHeaders headers;

    /*========================================================================*
     *                         Construct Methods (构造方法)
     *========================================================================*/

    public HttpStreamOutputMessage(HttpHeaders headers, OutputStream stream){
        this.stream = stream;
        this.headers = headers;
    }

    /*========================================================================*
     *                         Public Methods (公有方法)
     *========================================================================*/
    @Override
    public OutputStream getBody() throws IOException {
        return stream;
    }

    @Override
    public HttpHeaders getHeaders() {
        return headers;
    }
    /*========================================================================*
     *                         Private Methods (私有方法)
     *========================================================================*/
}
